﻿using System;

namespace DL.AI.AIBT
{
    //选择节点
    public class Selector : BTNode
    {
        public Selector(string name,int priority = 0) : base(name,priority)
        {
        }

        public override Status Process()
        {
            if (m_CurrentChild < Children.Count)
            {
                switch (Children[m_CurrentChild].Process())
                {
                    case Status.Success:
                        Reset();
                        return Status.Success;
                    case Status.Failure:
                        m_CurrentChild++;
                        return Status.Running;
                    case Status.Running:
                        return Status.Running;
                }
            }
            Reset();
            return Status.Failure;
        }
    }
}